.class public Lcom/netease/newsreader/activity/BaseActivity;
.super Landroid/app/Activity;
.source "BaseActivity.java"

# interfaces
.implements Lcom/netease/newsreader/util/ThemeSettingsHelper$ThemeCallback;


# instance fields
.field public app:Lcom/netease/newsreader/activity/MyApplication;

.field public db:Landroid/database/sqlite/SQLiteDatabase;

.field private mPaused:Z

.field private mThemeChanged:Z

.field private mThemeSettingsHelper:Lcom/netease/newsreader/util/ThemeSettingsHelper;

.field protected menuWindow:Landroid/widget/PopupWindow;

.field public screenheight:I

.field public screentype:I

.field public screenwidth:I

.field public sp:Landroid/content/SharedPreferences;

.field public final swipe_max_off_path:I

.field public final swipe_min_distance:I

.field public final swipe_threshold_veloicty:I


# direct methods
.method public constructor <init>()V
    .locals 1

    .prologue
    .line 24
    invoke-direct {p0}, Landroid/app/Activity;-><init>()V

    .line 25
    const/4 v0, 0x3

    iput v0, p0, Lcom/netease/newsreader/activity/BaseActivity;->screentype:I

    .line 29
    const/16 v0, 0x1e0

    iput v0, p0, Lcom/netease/newsreader/activity/BaseActivity;->screenwidth:I

    .line 30
    const/16 v0, 0x320

    iput v0, p0, Lcom/netease/newsreader/activity/BaseActivity;->screenheight:I

    .line 31
    const/16 v0, 0x96

    iput v0, p0, Lcom/netease/newsreader/activity/BaseActivity;->swipe_min_distance:I

    .line 32
    const/16 v0, 0x32

    iput v0, p0, Lcom/netease/newsreader/activity/BaseActivity;->swipe_max_off_path:I

    .line 33
    const/16 v0, 0x12c

    iput v0, p0, Lcom/netease/newsreader/activity/BaseActivity;->swipe_threshold_veloicty:I

    .line 123
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/netease/newsreader/activity/BaseActivity;->mPaused:Z

    .line 24
    return-void
.end method


# virtual methods
.method public applyTheme()V
    .locals 1

    .prologue
    .line 127
    iget-boolean v0, p0, Lcom/netease/newsreader/activity/BaseActivity;->mPaused:Z

    if-eqz v0, :cond_0

    .line 128
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/netease/newsreader/activity/BaseActivity;->mThemeChanged:Z

    .line 132
    :goto_0
    return-void

    .line 130
    :cond_0
    invoke-virtual {p0}, Lcom/netease/newsreader/activity/BaseActivity;->onApplyTheme()V

    goto :goto_0
.end method

.method public getThemeSettingsHelper()Lcom/netease/newsreader/util/ThemeSettingsHelper;
    .locals 1

    .prologue
    .line 135
    iget-object v0, p0, Lcom/netease/newsreader/activity/BaseActivity;->mThemeSettingsHelper:Lcom/netease/newsreader/util/ThemeSettingsHelper;

    return-object v0
.end method

.method public onApplyTheme()V
    .locals 0

    .prologue
    .line 142
    return-void
.end method

.method protected onCreate(Landroid/os/Bundle;)V
    .locals 4
    .parameter "savedInstanceState"

    .prologue
    .line 38
    invoke-super {p0, p1}, Landroid/app/Activity;->onCreate(Landroid/os/Bundle;)V

    .line 39
    invoke-static {p0}, Lcom/netease/newsreader/util/ThemeSettingsHelper;->getThemeSettingsHelper(Landroid/content/Context;)Lcom/netease/newsreader/util/ThemeSettingsHelper;

    move-result-object v2

    iput-object v2, p0, Lcom/netease/newsreader/activity/BaseActivity;->mThemeSettingsHelper:Lcom/netease/newsreader/util/ThemeSettingsHelper;

    .line 40
    iget-object v2, p0, Lcom/netease/newsreader/activity/BaseActivity;->mThemeSettingsHelper:Lcom/netease/newsreader/util/ThemeSettingsHelper;

    invoke-virtual {v2, p0}, Lcom/netease/newsreader/util/ThemeSettingsHelper;->registerThemeCallback(Lcom/netease/newsreader/util/ThemeSettingsHelper$ThemeCallback;)V

    .line 42
    invoke-static {p0}, Landroid/preference/PreferenceManager;->getDefaultSharedPreferences(Landroid/content/Context;)Landroid/content/SharedPreferences;

    move-result-object v2

    iput-object v2, p0, Lcom/netease/newsreader/activity/BaseActivity;->sp:Landroid/content/SharedPreferences;

    .line 43
    invoke-virtual {p0}, Lcom/netease/newsreader/activity/BaseActivity;->getApplicationContext()Landroid/content/Context;

    move-result-object v2

    check-cast v2, Lcom/netease/newsreader/activity/MyApplication;

    iput-object v2, p0, Lcom/netease/newsreader/activity/BaseActivity;->app:Lcom/netease/newsreader/activity/MyApplication;

    .line 45
    iget-object v2, p0, Lcom/netease/newsreader/activity/BaseActivity;->app:Lcom/netease/newsreader/activity/MyApplication;

    invoke-virtual {v2}, Lcom/netease/newsreader/activity/MyApplication;->getSQLiteDatabase()Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v2

    iput-object v2, p0, Lcom/netease/newsreader/activity/BaseActivity;->db:Landroid/database/sqlite/SQLiteDatabase;

    .line 46
    iget-object v2, p0, Lcom/netease/newsreader/activity/BaseActivity;->db:Landroid/database/sqlite/SQLiteDatabase;

    if-eqz v2, :cond_0

    iget-object v2, p0, Lcom/netease/newsreader/activity/BaseActivity;->db:Landroid/database/sqlite/SQLiteDatabase;

    invoke-virtual {v2}, Landroid/database/sqlite/SQLiteDatabase;->isOpen()Z

    move-result v2

    if-nez v2, :cond_1

    .line 47
    :cond_0
    new-instance v0, Lcom/netease/newsreader/db/NewsSQLiteOpenHelper;

    invoke-virtual {p0}, Lcom/netease/newsreader/activity/BaseActivity;->getApplicationContext()Landroid/content/Context;

    move-result-object v2

    invoke-direct {v0, v2}, Lcom/netease/newsreader/db/NewsSQLiteOpenHelper;-><init>(Landroid/content/Context;)V

    .line 48
    .local v0, sqlOpenHelper:Lcom/netease/newsreader/db/NewsSQLiteOpenHelper;
    invoke-virtual {v0}, Lcom/netease/newsreader/db/NewsSQLiteOpenHelper;->getWritableDatabase()Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v2

    iput-object v2, p0, Lcom/netease/newsreader/activity/BaseActivity;->db:Landroid/database/sqlite/SQLiteDatabase;

    .line 49
    iget-object v2, p0, Lcom/netease/newsreader/activity/BaseActivity;->app:Lcom/netease/newsreader/activity/MyApplication;

    iget-object v3, p0, Lcom/netease/newsreader/activity/BaseActivity;->db:Landroid/database/sqlite/SQLiteDatabase;

    invoke-virtual {v2, v3}, Lcom/netease/newsreader/activity/MyApplication;->setDb(Landroid/database/sqlite/SQLiteDatabase;)V

    .line 50
    iget-object v2, p0, Lcom/netease/newsreader/activity/BaseActivity;->app:Lcom/netease/newsreader/activity/MyApplication;

    invoke-virtual {v2, v0}, Lcom/netease/newsreader/activity/MyApplication;->setSqlOpenHelper(Lcom/netease/newsreader/db/NewsSQLiteOpenHelper;)V

    .line 52
    .end local v0           #sqlOpenHelper:Lcom/netease/newsreader/db/NewsSQLiteOpenHelper;
    :cond_1
    invoke-static {p0}, Lcom/netease/newsreader/util/Tools;->getScreenMetrics(Landroid/content/Context;)I

    move-result v2

    iput v2, p0, Lcom/netease/newsreader/activity/BaseActivity;->screentype:I

    .line 53
    invoke-static {p0}, Lcom/netease/newsreader/util/Tools;->getWidth_Height(Landroid/content/Context;)Ljava/util/HashMap;

    move-result-object v1

    .line 54
    .local v1, whmap:Ljava/util/HashMap;,"Ljava/util/HashMap<Ljava/lang/String;Ljava/lang/Integer;>;"
    const-string v2, "w"

    invoke-virtual {v1, v2}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Ljava/lang/Integer;

    invoke-virtual {v2}, Ljava/lang/Integer;->intValue()I

    move-result v2

    iput v2, p0, Lcom/netease/newsreader/activity/BaseActivity;->screenwidth:I

    .line 55
    const-string v2, "h"

    invoke-virtual {v1, v2}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Ljava/lang/Integer;

    invoke-virtual {v2}, Ljava/lang/Integer;->intValue()I

    move-result v2

    iput v2, p0, Lcom/netease/newsreader/activity/BaseActivity;->screenheight:I

    .line 56
    return-void
.end method

.method protected onDestroy()V
    .locals 1

    .prologue
    .line 81
    invoke-super {p0}, Landroid/app/Activity;->onDestroy()V

    .line 82
    iget-object v0, p0, Lcom/netease/newsreader/activity/BaseActivity;->mThemeSettingsHelper:Lcom/netease/newsreader/util/ThemeSettingsHelper;

    invoke-virtual {v0, p0}, Lcom/netease/newsreader/util/ThemeSettingsHelper;->unRegisterThemeCallback(Lcom/netease/newsreader/util/ThemeSettingsHelper$ThemeCallback;)V

    .line 83
    iget-object v0, p0, Lcom/netease/newsreader/activity/BaseActivity;->menuWindow:Landroid/widget/PopupWindow;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/netease/newsreader/activity/BaseActivity;->menuWindow:Landroid/widget/PopupWindow;

    invoke-virtual {v0}, Landroid/widget/PopupWindow;->isShowing()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 84
    iget-object v0, p0, Lcom/netease/newsreader/activity/BaseActivity;->menuWindow:Landroid/widget/PopupWindow;

    invoke-virtual {v0}, Landroid/widget/PopupWindow;->dismiss()V

    .line 86
    :cond_0
    return-void
.end method

.method protected onPause()V
    .locals 1

    .prologue
    .line 71
    invoke-super {p0}, Landroid/app/Activity;->onPause()V

    .line 72
    iget-object v0, p0, Lcom/netease/newsreader/activity/BaseActivity;->menuWindow:Landroid/widget/PopupWindow;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/netease/newsreader/activity/BaseActivity;->menuWindow:Landroid/widget/PopupWindow;

    invoke-virtual {v0}, Landroid/widget/PopupWindow;->isShowing()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 73
    iget-object v0, p0, Lcom/netease/newsreader/activity/BaseActivity;->menuWindow:Landroid/widget/PopupWindow;

    invoke-virtual {v0}, Landroid/widget/PopupWindow;->dismiss()V

    .line 75
    :cond_0
    return-void
.end method

.method protected onResume()V
    .locals 3

    .prologue
    const/4 v2, 0x0

    .line 90
    invoke-super {p0}, Landroid/app/Activity;->onResume()V

    .line 91
    iput-boolean v2, p0, Lcom/netease/newsreader/activity/BaseActivity;->mPaused:Z

    .line 108
    iget-boolean v1, p0, Lcom/netease/newsreader/activity/BaseActivity;->mThemeChanged:Z

    if-eqz v1, :cond_0

    .line 109
    iput-boolean v2, p0, Lcom/netease/newsreader/activity/BaseActivity;->mThemeChanged:Z

    .line 110
    invoke-virtual {p0}, Lcom/netease/newsreader/activity/BaseActivity;->onApplyTheme()V

    .line 113
    :cond_0
    instance-of v1, p0, Lcom/netease/newsreader/activity/DetailPage;

    if-nez v1, :cond_1

    instance-of v1, p0, Lcom/netease/newsreader/activity/ShowComments;

    if-nez v1, :cond_1

    .line 114
    instance-of v1, p0, Lcom/netease/newsreader/activity/ImageSwitcherActivity;

    if-nez v1, :cond_1

    instance-of v1, p0, Lcom/netease/newsreader/activity/ShowColumnInMore;

    if-nez v1, :cond_1

    .line 115
    instance-of v1, p0, Lcom/netease/newsreader/activity/CollectActivity;

    if-eqz v1, :cond_2

    .line 116
    :cond_1
    invoke-virtual {p0}, Lcom/netease/newsreader/activity/BaseActivity;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    check-cast v0, Lcom/netease/newsreader/activity/MyApplication;

    .line 117
    .local v0, a:Lcom/netease/newsreader/activity/MyApplication;
    const-string v1, "Y"

    invoke-virtual {v0}, Lcom/netease/newsreader/activity/MyApplication;->getGoHome()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_2

    .line 118
    invoke-virtual {p0}, Lcom/netease/newsreader/activity/BaseActivity;->finish()V

    .line 120
    .end local v0           #a:Lcom/netease/newsreader/activity/MyApplication;
    :cond_2
    return-void
.end method

.method protected onStop()V
    .locals 1

    .prologue
    .line 62
    invoke-super {p0}, Landroid/app/Activity;->onStop()V

    .line 63
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/netease/newsreader/activity/BaseActivity;->mPaused:Z

    .line 64
    return-void
.end method
